#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <crypt.h>
#include <string.h>

int main(int argc, char *argv[])
{
  /* argv[1] is the password that needs encrypted */
  /* argv[2] is the salt required to compute the encrypted password */
  char *originalpassword=argv[1];
  char *salt = argv[2];
  char *encryptedpass;
  int i;

  if (argc!=3)
    {
      return EXIT_FAILURE; /* insufficent number of arguments */
    }
    
  originalpassword=argv[1];
  salt=argv[2];      

  encryptedpass=crypt(originalpassword,salt);
  if (encryptedpass!=NULL)
    {
      printf("%s\n",encryptedpass);
      return EXIT_SUCCESS;
    }
  else /* this is if the crypt function didnt work */
    {
      return EXIT_FAILURE;
    }
}
